// 基站管理接口api
import { fetch, oss } from '@/utils/fetch.js';

/* 获取基站列表
 * @param {Object} params
 * schoolId / name / sn / page / pageSize
 * @returns {JSON} 返回基站列表
 */
export function getBaseStationList(params) {
  return fetch({
    url: '/usercenter/api/base_station/get_lists',
    method: 'POST',
    data: params,
  });
}

/* 获取基站详情
 * @param {Object} params
 * schoolId / baseStationId
 * @returns {JSON} 返回基站详情信息
 */
export function getBaseStationDetail(params) {
  return fetch({
    url: '/usercenter/api/base_station/get_row',
    method: 'POST',
    data: params,
  });
}

/* 新增基站
 * @param {Object} params
 * schoolId / name / sn / desc
 * @returns {JSON} 返回基站Id
 */
export function addBaseStation(params) {
  return fetch({
    url: '/usercenter/api/base_station/add',
    method: 'POST',
    data: params,
  });
}

/* 编辑基站
 * @param {Object} params
 * schoolId / name / sn / desc
 * @returns {JSON} 返回基站Id
 */
export function editBaseStation(params) {
  return fetch({
    url: '/usercenter/api/base_station/edit',
    method: 'POST',
    data: params,
  });
}

/* 删除基站
 * @param {Object} params
 * schoolId / baseStationId
 * @returns {JSON} 返回基站Id
 */
export function deleteBaseStation(params) {
  return fetch({
    url: '/usercenter/api/base_station/del',
    method: 'POST',
    data: params,
  });
}

/* 绑定基站
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationBindClass(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/class',
    method: 'POST',
    data: params,
  });
}

/* 基站答题器分页
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationAmList(params) {
  return fetch({
    url: '/usercenter/api/base_station/am/get_lists',
    method: 'POST',
    data: params,
  });
}

/* 基站答题器-删除基站下单个绑定答题器
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function delBaseStationAm(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/am/del',
    method: 'POST',
    data: params,
  });
}

/*  添加 答题器绑定基站
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function addBaseStationAm(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/am',
    method: 'POST',
    data: params,
  });
}

/*  基站答题器-下载导入模板
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationImportModule(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/am/download/import_module',
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

/*  基站答题器-导入答题器
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationImportAmlist(params) {
  return oss({
    baseUrl: '/usercenter/api/base_station/bind/am/import',
    method: 'POST',
    data: params,
  });
}

/*  基站答题器-导出
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationEmportAmlist(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/am/export',
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

/*  基站答题器-删除基站下所有答题器
 * @param {Object} params
 * schoolId / baseStationId / classIdList
 * @returns {JSON}
 */
export function baseStationDelAllAmlist(params) {
  return fetch({
    url: '/usercenter/api/base_station/bind/am/del_all',
    method: 'POST',
    data: params,
  });
}
